<template>
  <div class="body">
    <div :style="{height:offsetheight+'px'}">
<!--      地图-->
      <el-amap
        ref="amapgd"
        vid="amap"
        class="amap-demo"
        :mapStyle="mapStyle"
        :resizeEnable="true"
        :viewMode="viewMode"
        :zoom="zoom"
        :center="center"
        :events="events">
<!--        中心标记点-->
        <el-amap-marker vid="index_center" :position="center" :offset="markerOffset" :events="events1">
          <img v-if="pickInfo.grade !== '7'" :src="markerImg"/>
          <img v-if="pickInfo.grade === '7'"  width="30" height="30" :src="markerImg1"/>
        </el-amap-marker>
<!--        多边形-->
        <el-amap-polygon v-for="(polygon, index2) in polygons" :key="index2" :vid="polygon" :events="dot.events"
                         :path="polygon.path" :fillColor="polygon.fillColor" :bubble="polygon.bubble"
                         :fillOpacity="polygon.fillOpacity"></el-amap-polygon>
<!--        楼标记点-->
        <el-amap-marker zIndex="150" v-if="pickInfo.grade === '6' || pickInfo.grade === '5'"  v-for="(item3,index3) in BuildingList" :key="'item3-'+index3" :events="buildingEvents"
                        vid="index_center" :position="item3" :offset="markerOffset1">
<!--          重点人群楼标记点改变图标-->
          <div v-if="zdrqBuildingList[index3]===true">
            <img width="25" height="25" :src="makertype1"/>
          </div>
          <div v-else>
            <img width="25" height="25" :src="markerImg1"/>
          </div>
        </el-amap-marker>
<!--        特殊人群楼标记点-->
        <el-amap-marker zIndex="150" v-if="Gridswitch === true"  v-for="(item7,index7) in peopleBuildingList" :key="'item7-'+index7" :events="FocusGroupBuildingEvents"
                        vid="index_center" :position="item7" :offset="markerOffset1">
          <div v-if="pickInfo.grade === '3'">
            <img width="5" height="5" :src="makertype1"/>
          </div>
          <div v-if="pickInfo.grade === '4'">
            <img width="20" height="20" :src="makertype1"/>
          </div>
          <div v-if="pickInfo.grade === '5'">
            <img width="25" height="25" :src="makertype1"/>
          </div>
          <div v-if="pickInfo.grade === '6'">
            <img width="30" height="30" :src="makertype1"/>
          </div>
        </el-amap-marker>
<!--        场所标记点-->
<!--        v-if="pickInfo.grade === '6' || pickInfo.grade === '5'"-->
        <el-amap-marker  v-for="(item4,index4) in placeList" :key="'item4-'+index4"
                        vid="index_center1"  :offset="markerOffset1" :position="item4.csc_mapjson1" :events="placeEvents">
          <img width="10" height="10" :src="item4.icon"/>
        </el-amap-marker>
<!--        社会组织标记点-->
<!--        v-if="pickInfo.grade === '6' || pickInfo.grade === '5'"-->
        <el-amap-marker  v-for="(item5,index5) in societyList" :key="'item5-'+index5"
                        vid="index_center2"  :offset="markerOffset1" :position="item5.csc_mapjson1" :events="societyEvents">
          <img width="15" height="15" :src="item5.icon"/>
        </el-amap-marker>
<!--        物件标记点-->
<!--        v-if="pickInfo.grade === '6' || pickInfo.grade === '5'"-->
        <el-amap-marker  v-for="(item6,index6) in substanceList" :key="'item6-'+index6"
                        vid="index_center3"  :offset="markerOffset1" :position="item6.csc_mapjson1" :events="substanceEvents">
          <img width="15" height="15" :src="item6.icon"/>
        </el-amap-marker>

        <!--      <div class="teshu">-->
        <!--        <el-amap-marker zIndex="50" v-for="(item6,index6) in TSList" :key="'item6-'+index6"-->
        <!--                          vid="index_center3"  :offset="markerOffset2" :position="item6.csc_mapjson1" :events="TSevents">-->
        <!--          <img :width="10" :height="10" :src="makertype2"/>-->
        <!--        </el-amap-marker>-->
        <!--      </div>-->
<!--        信息窗体-->
        <el-amap-info-window :visible="window.visible" :events="window.events" :position="window.center">
          <div v-if="type === 1" class="info-window">
            <h1>{{pickInfo.name}}</h1>
            <Divider />
            <Row>
              <Col v-if="parseInt(this.pickInfo.grade)<3" span="8">
                <div>当前级别区数量<h1>{{StatisticsInfo.areaNum}}</h1></div>
              </Col>
              <Col v-if="parseInt(this.pickInfo.grade)<4" span="8">
                <div>当前级别街道数量<h1>{{StatisticsInfo.streetNum}}</h1></div>
              </Col>
              <Col v-if="parseInt(this.pickInfo.grade)<5" span="8">
                <div>当前级别社区数量<h1>{{StatisticsInfo.communityNum}}</h1></div>
              </Col>
<!--              <Col v-if="parseInt(this.pickInfo.grade)<6" span="8">-->
<!--                <div>当前级别网格数量<h1>{{StatisticsInfo.gardennum}}</h1></div>-->
<!--              </Col>-->
<!--              <Col v-if="parseInt(this.pickInfo.grade)<7" span="8">-->
<!--                <div>当前级别楼数量<h1>{{StatisticsInfo.buildingnum}}</h1></div>-->
<!--              </Col>-->
<!--              <Col span="8">-->
<!--                <div>当前级别户数<h1>{{StatisticsInfo.doorplatenum}}</h1></div>-->
<!--              </Col>-->
            </Row>
            <div class="detail" v-if="this.pickInfo.grade==='7'" @click="showDetail">查看详情</div>
          </div>
          <div v-if="type === 2" class="info-window">
            <h1>{{GridStatistics.info.name}}</h1>
            <Row>
              <Col v-if="parseInt(GridStatistics.info.grade)<4" span="8">
                <div>当前级别街道数量<h1>{{GridStatistics.streetNum}}</h1></div>
              </Col>
              <Col v-if="parseInt(GridStatistics.info.grade)<5" span="8">
                <div>当前级别社区数量<h1>{{GridStatistics.communityNum}}</h1></div>
              </Col>
              <Col v-if="parseInt(GridStatistics.info.grade)<5" span="8">
                <div>当前级别村数量<h1>{{GridStatistics.cunNum}}</h1></div>
              </Col>
              <Col v-if="GridStatistics.info.grade==='6'" span="8">
                <div @click="searchBuilding(GridStatistics.info)">当前级别楼数量<h1><Icon type="ios-search" />{{GridStatistics.buildingNum}}</h1></div>
              </Col>
              <!-- <Col v-if="GridStatistics.info.grade==='6'" span="8">
                <div @click="searchZbPerson(GridStatistics.info)">专班工作人员<h1><Icon type="ios-man" />{{GridStatistics.zbNum}}</h1></div>
              </Col> -->
            </Row>
            <div v-if="GridStatistics.info.grade==='7'" class="detail" @click="showDetailTwo">查看详情</div>
          </div>
        </el-amap-info-window>
      </el-amap>
      <Modal
        v-model="buildingModal"
        title="楼">
        <div style="height: 500px;overflow-y: auto">
          <Table :columns="BuildingColumns" :data="BuildingData">
            <template slot-scope="{ row, index }" slot="action">
              <Button type="primary" size="small" style="margin-right: 5px" @click="showBuilding(row)">查看</Button>
            </template>
          </Table>
        </div>
      </Modal>
      <!--    <Modal-->
      <!--      v-model="FocusGroupPeopleModel"-->
      <!--      title="重点人群列表">-->
      <!--      <template>-->
      <!--        <Table :columns="FocusGroupPeopleColumns" :data="FocusGroupPeopleData">-->
      <!--          <template slot-scope="{ row, index }" slot="action">-->
      <!--            <Button type="primary" size="small" style="margin-right: 5px" @click="getPeopleInfo(row)">查看</Button>-->
      <!--          </template>-->
      <!--        </Table>-->
      <!--      </template>-->
      <!--    </Modal>-->
      <Drawer width="600" title="重点人群" :closable="false" v-model="FocusGroupPeopleModel">
        <div class="divtitleClass">
          {{FocusGroupBuildingInfo.company_name}} {{FocusGroupBuildingInfo.garden_name}} {{FocusGroupBuildingInfo.name}}
        </div>
        <div class="divtitleClass">
          重点人群列表
        </div>
        <div class="divclass">
          <Table :columns="FocusGroupPeopleColumns" :data="FocusGroupPeopleData">
            <template slot-scope="{ row, index }" slot="user_name">
              <img v-for="(item,index) in row.label_img_group.split(',')" :key="index"  :src="item" style="width: 15px;height: 15px"/>
              {{row.user_name}}
            </template>
            <template slot-scope="{ row, index }" slot="action">
              <Button type="primary" size="small" style="margin-right: 5px" @click="getPeopleInfo(row)">查看</Button>
            </template>
          </Table>
        </div>
      </Drawer>
      <grid-module ref="gridModule"></grid-module>
<!--      <grid-person ref="gridPerson"></grid-person>-->
      <grid-person-new ref="gridPersonNew"></grid-person-new>
    </div>
<!--    场所Modal-->
    <Modal
      v-model="placeModal.show"
      width="1000">
      <p slot="header" style="text-align:left">
        <span style="font-size: 18px">{{ placeModal.info.name }}</span>
      </p>
      <Row>
        <Col span="17">
          <div class="divtitleClass">
            场所信息：
          </div>
          <div style="padding-left: 20px;font-size: 14px">
            <div>场所唯一信用代码：{{placeModal.info.place_tyshxydm}}</div>
            <div>场所地址：{{placeModal.info.place_address}}</div>
            <div>场所成立日期：{{placeModal.info.place_cl_time}}</div>
            <div>场所营业时间：{{placeModal.info.place_time_begin}} -{{placeModal.info.place_time_end}}</div>
            <div>场所描述：{{placeModal.info.place_remarks}}</div>
          </div>
          <div class="divtitleClass">
            负责人信息：
          </div>
          <div style="padding-left: 20px;font-size: 14px">
            <div>负责人姓名：{{placeModal.info.place_fzr}}</div>
            <div>负责人电话：{{placeModal.info.place_fzr_phone}}</div>
          </div>
        </Col>
        <Col span="1"></Col>
        <Col span="6">
          <Card style="width: 100%">
            <div>
              <div v-if="placeModal.show && placeModal.info.place_img_list.length >0" style="text-align: center;margin-bottom: 20px;margin-top: 20px">
                <Carousel v-model="place_value">
                  <CarouselItem v-for="(item,index) in placeModal.info.place_img_list" :key="index">
                      <img :src="item" width="100%">
                  </CarouselItem>
                </Carousel>
              </div>
              <div>所属区域：{{placeModal.info.area_name}}</div>
              <div>所属街道：{{placeModal.info.street_name}}</div>
              <div>所属社区：{{placeModal.info.community_name}}</div>
              <div>所属网格：{{placeModal.info.garden_name}}</div>
              <div>场所面积：{{placeModal.info.place_area}}㎡</div>
            </div>
          </Card>
        </Col>
      </Row>
      <div v-if="severUserInfo.company_code === 'LM20778' && placeModal.info.shipin_url" slot="footer">
        <Button type="error" size="large" @click="shipin(placeModal.info.shipin_url)">查看视频</Button>
      </div>
    </Modal>
<!--    社会组织Modal-->
    <Modal
      v-model="societyModal.show"
      width="1000">
      <p slot="header" style="text-align:left">
        <span style="font-size: 18px">{{ societyModal.info.name }}</span>
      </p>
      <Row>
        <Col span="17">
          <div class="divtitleClass">
            社会组织信息：
          </div>
          <div style="padding-left: 20px;font-size: 14px">
            <div>社会组织唯一信用代码：{{societyModal.info.tyshxydm}}</div>
            <div>发证机关：{{societyModal.info.fzjg}}</div>
            <div>社会组织地址：{{societyModal.info.address}}</div>
            <div>社会组织描述：{{societyModal.info.remarks}}</div>
          </div>
          <div class="divtitleClass">
            法人信息：
          </div>
          <div style="padding-left: 20px;font-size: 14px">
            <div>法人姓名：{{societyModal.info.fr_name}}</div>
            <div>法人身份证号：{{societyModal.info.TMcardno}}</div>
            <div>法人电话：{{societyModal.info.fr_phone}}</div>
          </div>
        </Col>
        <Col span="1"></Col>
        <Col span="6">
          <Card style="width: 100%">
            <div>
              <div v-if="societyModal.show && societyModal.info.shzz_img_list.length > 0" style="text-align: center;margin-bottom: 20px;margin-top: 20px">
                <Carousel v-model="society_value">
                  <CarouselItem v-for="(item,index) in societyModal.info.shzz_img_list" :key="index">
                    <img :src="item" width="100%">
                  </CarouselItem>
                </Carousel>
              </div>
              <div>所属区域：{{societyModal.info.area_name}}</div>
              <div>所属街道：{{societyModal.info.street_name}}</div>
              <div>所属社区：{{societyModal.info.community_name}}</div>
              <div>所属网格：{{societyModal.info.garden_name}}</div>
              <div>场所面积：{{societyModal.info.shzz_area}}㎡</div>
            </div>
          </Card>
        </Col>
      </Row>
    </Modal>
<!--    物件Modal-->
    <Modal
      v-model="substanceModal.show"
      width="1000">
      <p slot="header" style="text-align:left">
        <span style="font-size: 18px">{{ substanceModal.info.name }}</span>
      </p>
      <Row>
        <Col span="17">
          <div class="divtitleClass">
           物件信息：
          </div>
          <div style="padding-left: 20px;font-size: 14px">
            <div>物件编码：{{substanceModal.info.wj_code}}</div>
            <div>物件地址：{{substanceModal.info.wj_address}}</div>
            <div>物件描述：{{substanceModal.info.remark}}</div>
          </div>
          <div class="divtitleClass">
            负责人信息：
          </div>
          <div style="padding-left: 20px;font-size: 14px">
            <div>负责人姓名：{{substanceModal.info.wj_fzr}}</div>
            <div>负责人电话：{{substanceModal.info.wj_fzr_phone}}</div>
          </div>
        </Col>
        <Col span="1"></Col>
        <Col span="6">
          <Card style="width: 100%">
            <div>
              <div v-if="substanceModal.show && substanceModal.info.wj_img_list.length > 0" style="text-align: center;margin-bottom: 20px;margin-top: 20px">
                <Carousel v-model="substance_value">
                  <CarouselItem v-for="(item,index) in substanceModal.info.wj_img_list" :key="index">
                    <img :src="item" width="100%">
                  </CarouselItem>
                </Carousel>
              </div>
              <div>所属区域：{{substanceModal.info.area_name}}</div>
              <div>所属街道：{{substanceModal.info.street_name}}</div>
              <div>所属社区：{{substanceModal.info.community_name}}</div>
              <div>所属网格：{{substanceModal.info.garden_name}}</div>
            </div>
          </Card>
        </Col>
      </Row>
      <div v-if="severUserInfo.company_code === 'LM20778' && substanceModal.info.shipin_url" slot="footer">
        <Button type="error" size="large" @click="shipin(substanceModal.info.shipin_url)">查看视频</Button>
      </div>
    </Modal>
<!--    v-if="parseInt(pickInfo.grade) >= 5 "-->

    <div  class="TLDIVClass">
      <span v-for="(itemZY,indexZY) in GridZYList" :key="indexZY" class="TLSpan" :class="{ClickTLSpan : itemZY.is_pick === true}" @click="TLClick(itemZY,indexZY)">
          <img :src="itemZY.icon" width="20px" height="20px" style="margin-right: 5px">{{itemZY.name}}
      </span>
    </div>
    <div v-if="GridZYList.length > 0 && GridZYList[0].is_pick === true" class="TLDIVClass1">
      <span v-for="(itemP,indexP) in GridZYList[0].children" :key="indexP" class="TLSpan" :class="{ClickTLSpan : itemP.is_pick === true}" @click="TLClickForSecond(itemP,indexP)">
          <img :src="itemP.icon" width="20px" height="20px" style="margin-right: 5px">{{itemP.name}}
      </span>
    </div>

    <!-- 专班工作人员列表抽屉 -->
    <Drawer title="专班工作人员列表" width="900" :closable="false" v-model="zbDrawer">
      <template>
        <div class="zb-div">
          <Card :dis-hover="true" :class="[zbTypeNums.xcgbNum && zbTypeNums.xcgbNum  > 0 ? 'select-zb-card' : '']" style="width:123px;margin-bottom:5px;float:left;margin-right:5px;font-size:13px;">
            <span>下沉干部：</span><span>{{zbTypeNums.xcgbNum || 0}}人</span>
          </Card>
          <Card :dis-hover="true" :class="[zbTypeNums.gazfNum && zbTypeNums.gazfNum  > 0 ? 'select-zb-card' : '']" style="width:123px;margin-bottom:5px;float:left;margin-right:5px;font-size:13px;">
            <span>公安执法：</span><span>{{zbTypeNums.gazfNum || 0}}人</span>
          </Card>
          <Card :dis-hover="true" :class="[(zbTypeNums.ylwsNum && zbTypeNums.ylwsNum  > 0) ? 'selectZbCard' : '']" style="width:206px;margin-bottom:5px;float:left;margin-right:5px;font-size:13px;">
            <span>医疗卫生（疾病控制）：</span><span>{{zbTypeNums.ylwsNum || 0}}人</span>
          </Card>
          <Card :dis-hover="true" :class="[(zbTypeNums.sqgzzNum && zbTypeNums.sqgzzNum  > 0) ? 'selectZbCard' : '']" style="width:140px;margin-bottom:5px;float:left;margin-right:5px;font-size:13px;">
            <span>社区工作者：</span><span>{{zbTypeNums.sqgzzNum || 0}}人</span>
          </Card>
          <Card :dis-hover="true" :class="[(zbTypeNums.wyryNum && zbTypeNums.wyryNum  > 0) ? 'selectZbCard' : '']" style="width:123px;margin-bottom:5px;float:left;margin-right:5px;font-size:13px;">
            <span>物业人员：</span><span>{{zbTypeNums.wyryNum || 0}}人</span>
          </Card>
          <Card :dis-hover="true" :class="[(zbTypeNums.zyzNum && zbTypeNums.zyzNum  > 0) ? 'selectZbCard' : '']" style="width:123px;margin-bottom:5px;float:left;margin-right:5px;font-size:13px;">
            <span>志愿者：</span><span>{{zbTypeNums.zyzNum || 0}}人</span>
          </Card>
        </div>
        <Table :columns="columns1" :data="data1" border>
          <template slot-scope="{ row, index }" slot="state">
            <span v-if="row.state == '1'">下沉干部</span>
            <span v-else-if="row.state == '2'">公安执法</span>
            <span v-else-if="row.state == '3'">医疗卫生（疾病控制）</span>
            <span v-else-if="row.state == '4'">社区工作者</span>
            <span v-else-if="row.state == '5'">物业人员</span>
            <span v-else-if="row.state == '6'">志愿者</span>
          </template>
          <template slot-scope="{ row, index }" slot="job">
            <span v-if="row.job == '1'">处长</span>
            <span v-else-if="row.job == '2'">副处长</span>
            <span v-else-if="row.job == '3'">科长</span>
            <span v-else-if="row.job == '4'">副科长</span>
          </template>
          <template slot-scope="{ row, index }" slot="level">
            <span v-if="row.level == '3'">区县</span>
            <span v-else-if="row.level == '4'">街道</span>
            <span v-else-if="row.level == '5'">社区</span>
            <span v-else-if="row.level == '6'">点位</span>
          </template>
          <template slot-scope="{ row, index }" slot="point_state">
            <span v-if="row.level == '1'">点位专班</span>
            <span v-else-if="row.level == '2'">应急机动队</span>
            <span v-else-if="row.level == '3'">预备队</span>
          </template>
        </Table>
      </template>
    </Drawer>
  </div>
</template>

<script>
import {
  getGridInfo,
  findAllGridList,
  findSubordinateList,
  getBuildingByCoordinates,
  // findMerchantList,
  // getGardenByCoordinates,
  getGridByGardenId,
  // findSocietyList,
  getGridGardenById,
  // getStatistics,
  distance,
  findBuildingListByCommunity,
  findCompanyScopeByGradeList,
  findTeShuList,
  findBuidingRuhuList,
  findPeopleFocusGroupLabelList,
  findPeopleFocusGroupLInfoList,
  getCompanyInfoByCompanyScope,
  getPlaceByCscmapjson,
  getSocietyByCscmapjson,
  getSubstanceByCscmapjson,
  // findGridZYList,
  findMerchantByMapList,
  findSocietyByMapList,
  findSubstanceByMapList,
  findSiteList,
  findStatisticsInfo
} from '@/api/eventlist'
import GridPerson from '../components/grid-person'
import GridModule from './grid-module'
import GridPersonNew from './grid-person-new'
import { getBuildingNum, getOfficeStatistics } from '../../../../api/grid-statistics'
import { findGridTypeList, findMerchantByMapNewList, getSiteNum } from '../../../../api/eventlist'
export default {
  name: 'grid-map',
  components: { GridPersonNew, GridModule, GridPerson },
  props: {
    pickID: {
      type: String
    },
    pickGrade: {
      type: String
    },
    Gridswitch: {
      type: Boolean
    }
  },
  data () {
    let self = this
    return {
      severUserInfo: {},
      // placeSize: 10,
      amap: null, // 地图实力
      viewMode: this.$store.state.user.severUserInfo.loginName === 'LM40011' ? '3D' : '', // 2D 3D开关
      mapStyle: this.$store.state.user.severUserInfo.loginName === 'LM40011' ? 'amap://styles/a7630a38390f2733813e451138b95ede' : '',
      FocusGroupBuildingInfo: {},
      FocusGroupPeopleColumns: [
        {
          title: '姓名',
          slot: 'user_name',
          align: 'center'
        },
        {
          title: '身份证号',
          key: 'cardno',
          align: 'center'
        },
        // {
        //   title: '标签',
        //   slot: 'label_img_group',
        //   align: 'center'
        // },
        {
          title: '操作',
          slot: 'action',
          width: 150,
          align: 'center'
        }
      ],
      FocusGroupPeopleData: [],
      FocusGroupPeopleModel: false,
      BuildingColumns: [
        {
          title: '名称',
          key: 'name'
        },
        {
          title: '蓝牌号',
          key: 'brand'
        },
        {
          title: '入户人数',
          key: 'ruhuNum'
        },
        {
          title: '查看',
          slot: 'action',
          width: 150,
          align: 'center'
        }
      ],
      BuildingData: [],
      buildingModal: false,
      size: 35,
      aa: 0,
      type: 1,
      offsetheight: document.documentElement.clientHeight - 145,
      pickInfo: {},
      zoom: 9, // 缩放程度
      center: [123.412581, 41.805853], // 中心点
      events: {
        complete () {
          let amap = self.$refs.amapgd.$$getInstance()
          // vue挂载地图实例
          this.amap = amap
          if (self.$store.state.user.severUserInfo.loginName === 'LM40011') {
            amap.setPitch(50)
            amap.setRotation(25)
            amap.setZoom(9)
          } else {
            amap.setFeatures(['bg', 'point', 'road', 'postMessage'])
          }
        },
        mousewheel (e) {
          console.log('zoom', e.target.getZoom())
          // self.placeSize = e.target.getZoom() * 1.2
        },
        click (e) {
          let { lng, lat } = e.lnglat
          self.lng = lng
          self.lat = lat
          // 这里通过高德 SDK 完成。
          let geocoder = new AMap.Geocoder({
            radius: 1000,
            extensions: 'all'
          })
          geocoder.getAddress([lng, lat], function (status, result) {
            if (status === 'complete' && result.info === 'OK') {
              if (result && result.regeocode) {
                self.address = result.regeocode.formattedAddress
                self.$nextTick()
              }
            }
          })
        }
      }, // 地图事件
      markerImg: './img/poi-marker-red.png', // 标记点图标
      // markerImg1: 'http://imgdl.tripln.top/webhdfs/v1//_1451361183.png?op=OPEN&namenoderpcaddress=hadoop01:9000&offset=0',
      markerImg1: 'http://imgdl.tripln.top/webhdfs/v1//_3340741777.png?op=OPEN&namenoderpcaddress=hadoop01:9000&offset=0',
      markerImg2: '',
      makertype1: 'http://imgdl.tripln.top/webhdfs/v1//_9158739104.png?op=OPEN&namenoderpcaddress=hadoop01:9000&offset=0',
      // makertype1: 'http://imgdl.tripln.top/webhdfs/v1//.png_6742780741.png?op=OPEN&namenoderpcaddress=hadoop01:9000&offset=0',
      makertype2: 'https://a.amap.com/jsapi_demos/static/images/mass1.png',
      markerOffset: [-25, -45], // 地图点偏移
      markerOffset1: [-15, -15],
      // markerOffset2: [-15, -18],
      markerOffset2: [0, 0],
      events1: {
        click () {
          // self.window.visible = true
          // self.type = 1
          // self.window.center = self.center
          // self.getStatistics()
          self.retuenGridInfoToIndex(self.pickInfo.grade, self.pickInfo.id)
        }
      }, // 标记点事件
      polygons: [
        {
          bubble: true,
          fillOpacity: '0.2',
          fillColor: '#f77777',
          path: []
        }
      ],
      BuildingList: [],
      window: {
        center: [0, 0],
        visible: false,
        events: {
          close () {
            self.window.visible = false
          }
        }
      },
      StatisticsInfo: {},
      // StatisticsInfo1: {},
      pickPath: {
        grade: '',
        path: ''
      },
      dot: {
        events: {
          click (e) {
            console.log(e)
            let x = e.target.w.path
            let y = []
            x.forEach(item => {
              let data = [item.lng, item.lat]
              y.push(data)
            })
            if (y.length > 0) {
              self.pickPath.grade = parseInt(self.pickInfo.grade) + 1
              self.pickPath.path = JSON.stringify(y)
              self.clickGrid(JSON.stringify(y))
            }
            self.window.center = [e.lnglat.lng, e.lnglat.lat]
          }
        }
      },
      buildingEvents: {
        click (e) {
          console.log(e)
          let x = e.target.De.position.lng + ',' + e.target.De.position.lat
          console.log(x)
          self.BuildingList.forEach(item => {
            let y = item[0] + ',' + item[1]
            if (x === y) {
              self.getGridByGardenId(y, 7)
              self.window.center = [e.lnglat.lng, e.lnglat.lat]
            }
          })
        }
      },
      FocusGroupBuildingEvents: {
        click (e) {
          let x = e.target.De.position.lng + ',' + e.target.De.position.lat
          self.peopleBuildingList.forEach(item => {
            let y = item[0] + ',' + item[1]
            if (x === y) {
              self.findPeopleFocusGroupLInfoList(y)
            }
          })
        }
      },
      placeList: [],
      societyList: [],
      TSList: [],
      TSevents: {
        click (e) {
          let x = e.target.De.position.lng + ',' + e.target.De.position.lat
          self.distance(x)
        }
      },
      distanceInfo: {},
      zdrqBuildingList: [],
      GridStatistics: {},
      peopleBuildingList: [],
      // 场所Modal
      placeModal: {
        show: false,
        info: {}
      },
      // 社会组织Modal
      societyModal: {
        show: false,
        info: {}
      },
      // 场所编辑点事件
      placeEvents: {
        click (e) {
          // console.log('场所', e)
          let x = e.target.De.position.lng + ',' + e.target.De.position.lat
          // console.log(x)
          self.getPlaceByCscmapjson(x)
        }
      },
      // 社会组织标记点事件
      societyEvents: {
        click (e) {
          // console.log('社会组织', e)
          let x = e.target.De.position.lng + ',' + e.target.De.position.lat
          // console.log(x)
          self.getSocietyByCscmapjson(x)
        }
      },
      substanceList: [],
      // 物件标记点事件
      substanceEvents: {
        click (e) {
          // console.log('物件', e)
          let x = e.target.De.position.lng + ',' + e.target.De.position.lat
          // console.log(x)
          self.getSubstanceByCscmapjson(x)
        }
      },
      // 物件Modal
      substanceModal: {
        show: false,
        info: {}
      },
      // 场所轮播index
      place_value: 0,
      // 社会组织轮播index
      society_value: 0,
      // 物件轮播index
      substance_value: 0,
      // 图例
      GridZYList: [],
      ZyPlaceList: [],
      columns1: [
        {
          title: '序号',
          type: 'index',
          width: '60',
          align: 'center',
          fixed: 'left'
        },
        {
          title: '姓名',
          key: 'name',
          width: '80',
          align: 'center'
        },
        {
          title: '身份证号',
          key: 'card_no',
          width: '160',
          align: 'center'
        },
        {
          title: '联系方式',
          key: 'mobile',
          width: '120',
          align: 'center'
        },
        {
          title: '居住地',
          key: 'address',
          width: '200',
          align: 'center'
        },
        {
          title: '是否为本社区居民',
          key: 'resident',
          width: '120',
          align: 'center'
        },
        {
          title: '人员类别',
          slot: 'state',
          width: '80',
          align: 'center'
        },
        {
          title: '点长类型',
          key: 'point',
          width: '100',
          align: 'center'
        },
        {
          title: '工作单位',
          key: 'unit',
          width: '100',
          align: 'center'
        },
        {
          title: '职务',
          slot: 'job',
          width: '80',
          align: 'center'
        },
        {
          title: '级别',
          slot: 'level',
          width: '80',
          align: 'center'
        },
        {
          title: '点位专班类别',
          slot: 'point_state',
          width: '100',
          align: 'center'
        }
      ],
      data1: [],
      zbDrawer: false,
      zbTypeNums: {}
    }
  },
  methods: {
    shipin (e) {
      window.open(e)
    },
    // 更改地图视图模式
    setAMapViewMode (isShow3D) {
      let amap = this.$refs.amapgd.$$getInstance()
      if (isShow3D) {
        amap.setPitch(50)
        amap.setRotation(25)
        amap.setMapStyle('amap://styles/a7630a38390f2733813e451138b95ede')
        amap.setFeatures(['bg', 'point', 'road', 'building', 'postMessage'])
      } else {
        amap.setPitch(0)
        amap.setRotation(0)
        amap.setMapStyle('normal')
        amap.setFeatures(['bg', 'point', 'road', 'postMessage'])
      }
    },
    TLClickForSecond (item, index) {
      console.log('TLClickForSecond', this.GridZYList[0].children)
      let children = this.GridZYList[0].children
      children[index].is_pick = !item.is_pick
      this.GridZYList[0].children = children
      if (!this.GridZYList[0].children[index].is_pick) {
        // 取消选中
        let data = this.$common.xeUtils.clone(this.placeList)
        this.placeList = []
        data.forEach(item1 => {
          if (item1.merchant_type !== item.id) {
            this.placeList.push(item1)
          }
        })
      } else {
        this.findMerchantByMapListByTypeNew(item.id).then(ret => {
          console.log('ret1111', ret)
          this.GridZYList[0].is_pick = false
          this.$nextTick(() => {
            if (ret) {
              ret.forEach(Pitem => {
                this.placeList.push(Pitem)
              })
            }
            this.GridZYList[0].is_pick = true
          })
        })
      }
    },
    TLClick (item, index) {
      this.GridZYList[index].is_pick = !item.is_pick
      console.log(item)
      if (!this.GridZYList[index].is_pick) {
        // 取消选中
        if (this.GridZYList[index].type === 'W') {
          this.substanceList = []
        }
        if (this.GridZYList[index].type === 'S') {
          this.societyList = []
        }
        if (this.GridZYList[index].type === 'P') {
          this.placeList = []
        }
      } else {
        // 选中
        if (this.GridZYList[index].type === 'W') {
          this.substanceList = []
          this.findSubstanceByMapList()
        }
        if (this.GridZYList[index].type === 'S') {
          this.societyList = []
          this.findSocietyByMapList()
        }
        if (this.GridZYList[index].type === 'P') {
          // this.findMerchantByMapListByType(item.id).then(ret => {
          //   console.log('ret1111', ret)
          //   if (ret) {
          //     ret.forEach(Pitem => {
          //       this.placeList.push(Pitem)
          //     })
          //   }
          // })
          this.GridZYList[0].children.forEach(item => {
            item.is_pick = false
          })
        }
      }
    },
    getSubstanceByCscmapjson (e) {
      let data = {
        csc_mapjson: e
      }
      console.log(data)
      getSubstanceByCscmapjson(data).then(ret => {
        if (ret.data.errcode === 0) {
          let data = ret.data.data
          this.substanceModal.info = data
          try {
            this.substanceModal.info.wj_img_list = []
            this.substanceModal.info.wj_img_list = data.wj_img.split(',')
          } catch (e) {
            console.log('图片解析失败！')
          }
          this.substanceModal.show = true
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
    },
    getPlaceByCscmapjson (e) {
      let data = {
        csc_mapjson: e
      }
      console.log(data)
      getPlaceByCscmapjson(data).then(ret => {
        if (ret.data.errcode === 0) {
          let data = ret.data.data
          this.placeModal.info = data
          try {
            this.placeModal.info.place_img_list = []
            this.placeModal.info.place_img_list = data.place_img.split(',')
          } catch (e) {
            console.log('图片解析失败！')
          }
          this.placeModal.show = true
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
    },
    getSocietyByCscmapjson (e) {
      let data = {
        csc_mapjson: e
      }
      console.log(data)
      getSocietyByCscmapjson(data).then(ret => {
        if (ret.data.errcode === 0) {
          let data = ret.data.data
          this.societyModal.info = data
          try {
            this.societyModal.info.shzz_img_list = []
            this.societyModal.info.shzz_img_list = data.shzz_img.split(',')
          } catch (e) {
            console.log('图片解析失败！')
          }
          this.societyModal.show = true
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
    },
    // 将点击地图所附带信息传会index页
    retuenGridInfoToIndex (e1, e2) {
      let info = {
        grade: e1,
        id: e2
      }
      this.$emit('sendGridInfoToStatistics', info)
    },
    // 单击网格
    clickGrid (e) {
      switch (this.pickInfo.grade) {
        case '2':
          this.getCompanyInfoByCompanyScope(e, 3)
          break
        case '3':
          this.getGridByGardenId(e, 6)
          break
        case '4':
          this.getGridByGardenId(e, 6)
          break
        case '5':
          this.getGridByGardenId(e, 6)
          break
      }
    },
    // 点击区网格
    getCompanyInfoByCompanyScope (e1, e2) {
      let data = {
        company_scope: e1,
        grade: e2
      }
      getCompanyInfoByCompanyScope(data).then(ret => {
        if (ret.data.errcode === 0) {
          let resultData = ret.data.data
          let result = {
            info: resultData
          }
          this.getOfficeStatistics(resultData.grade, resultData.id)
          this.disposeTypeWindosInfo(result)
          this.retuenGridInfoToIndex(resultData.grade, resultData.id)
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
    },
    // 查询层级信息
    getOfficeStatistics (e1, e2) {
      let data = {
        grade: e1,
        id: e2
      }
      getOfficeStatistics(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          this.GridStatistics = result
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // type === 2 统计信息窗体
    disposeTypeWindosInfo (e) {
      this.type = 2
      this.window.visible = true
      this.GridStatistics = e
    },
    // 初始化
    init () {
      this.window.visible = false
      let data = {
        grade: this.pickGrade,
        id: this.pickID
      }
      getGridInfo(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.pickInfo = ret.data.data
          this.disposeCoordinate()
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
    },
    // 处理查询结果
    disposeCoordinate () {
      this.TSList = []
      this.polygons = []
      this.BuildingList = []
      this.zdrqBuildingList = []
      this.peopleBuildingList = []
      this.placeList = []
      this.societyList = []
      this.substanceList = []
      switch (this.pickInfo.grade) {
        case '2':
          this.disposeCscMapjson()
          // this.findAllGridList()
          this.findCompanyScopeByGradeList('2')
          break
        case '3':
          if (this.Gridswitch === true) {
            this.findFocusGroupLabelList()
          } else {
            this.disposeCscMapjson()
            this.getGarden()
          }
          break
        case '4':
          if (this.Gridswitch === true) {
            this.findFocusGroupLabelList()
          } else {
            this.disposeCscMapjson()
            this.getGarden()
          }
          break
        case '5':
          if (this.Gridswitch === true) {
            this.findFocusGroupLabelList()
            this.disposeCscMapjson()
            this.getGarden()
          } else {
            this.disposeCscMapjson()
            this.getGarden()
            this.findBuildingListByCommunity()
            // this.findMerchantByMapList()
            // this.findSocietyByMapList()
            // this.findSubstanceByMapList()
          }
          break
        case '6':
          if (this.Gridswitch === true) {
            this.findFocusGroupLabelList()
            this.disposeGrid()
          } else {
            this.disposeGrid()
            this.getBuildingByGarden()
            this.findMerchantByMapList()
            this.findSocietyByMapList()
            this.findSubstanceByMapList()
          }
          break
        case '7':
          this.disposeCscMapjson()
          this.getGridGardenById()
          break
      }
      this.autoZoom()
      this.findGridZYList()
    },
    // 查询图例
    findGridZYList () {
      findGridTypeList().then(ret => {
        if (ret.data.errcode === 0) {
          let data = ret.data.data
          data.forEach(item => {
            if (this.pickInfo.grade === '6') {
              item.is_pick = true
            } else {
              item.is_pick = false
            }
          })
          this.GridZYList = data
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
      // let data = {
      //   pid: '0'
      // }
      // findGridZYList(data).then(ret => {
      //   if (ret.data.errcode === 0) {
      //     let data = ret.data.data
      //     data.forEach(item => {
      //       if (this.pickInfo.grade === '6') {
      //         item.is_pick = true
      //       } else {
      //         item.is_pick = false
      //       }
      //     })
      //     this.GridZYList = data
      //   } else {
      //     this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
      //   }
      // })
    },
    // 根据等级查询机构范围
    findCompanyScopeByGradeList (e) {
      let data = {
        grade: e
      }
      findCompanyScopeByGradeList(data).then(ret => {
        if (ret.data.errcode === 0) {
          if (ret.data.data.length > 0) {
            let result = ret.data.data
            let color = ['#D2691E', '#0000E3', '#A52A2A', '#FFE4C4', '#FFB6C1', '#556B2F', '#00FFFF', '#BC8F8F', '#4169E1', '#B0E0E6', '#FFF5EE', '#4682B4', '#9ACD32']
            result.forEach((item, index) => {
              if (item.code === 'LM00007') {
                let data = item.company_scope.split('-')
                data.forEach(item1 => {
                  this.polygons.push(this.disposeNew(item1, color[index]))
                })
              } else {
                this.polygons.push(this.disposeNew(item.company_scope, color[index]))
              }
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.errmsg })
        }
      })
    },
    // 查询楼（当层级为社区时）
    findBuildingListByCommunity () {
      console.log(123)
      let data = {
        id: this.pickID
      }
      console.log(data)
      findBuildingListByCommunity(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          result.forEach(item => {
            if (item.csc_mapjson !== undefined) {
              let center = [parseFloat(item.csc_mapjson.split(',')[0]), parseFloat(item.csc_mapjson.split(',')[1])]
              this.BuildingList.push(center)
            }
            if (item.zd !== undefined) {
              this.zdrqBuildingList.push(true)
            } else {
              this.zdrqBuildingList.push(false)
            }
          })
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // 查询重点人群
    findTeShuList () {
      let data = {
        id: this.pickID,
        grade: this.pickGrade
      }
      findTeShuList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.TSList = []
          this.TSList = ret.data.data
          if (this.TSList.length !== 0) {
            this.TSList.forEach((item, index) => {
              let x = item.csc_mapjson.split(',')
              let y = []
              y.push(x[0])
              y.push(x[1])
              item.csc_mapjson1 = y
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // 重点人群测距
    distance (x) {
      let data = {
        csc_mapjson: x
      }
      distance(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.distanceInfo = {}
          this.distanceInfo = ret.data.data
          this.$Notice.success({ title: '查询成功！', desc: '当前位置到' + this.distanceInfo.name + '中心点距离为' + this.distanceInfo.distance + '米' })
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // 层级为楼时，也展示网格
    getGridGardenById () {
      let data = {
        garden_id: this.pickInfo.garden_id
      }
      getGridGardenById(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.dispose(ret.data.data.csc_mapjson)
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // LM 查询全部网格
    findAllGridList () {
      findAllGridList().then(ret => {
        if (ret.data.errcode === 0) {
          if (ret.data.data.length > 0) {
            let result = ret.data.data
            result.forEach(item => {
              this.dispose(item.csc_mapjson)
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // 处理网格部分
    disposeGrid () {
      if (this.pickInfo.csc_mapjson === undefined || this.pickInfo.csc_mapjson === '') {
        this.$Notice.error({ title: '网格获取失败', desc: '该区域未添加网格' })
      } else {
        this.dispose(this.pickInfo.csc_mapjson)
        this.center = this.autoCenter(this.pickInfo.csc_mapjson)
      }
    },
    // 处理多边形
    dispose (e) {
      try {
        let data = {
          bubble: true,
          fillColor: '#f77777',
          fillOpacity: '0.2',
          path: JSON.parse(e)
        }
        this.polygons.push(data)
        // this.polygons[0].path.push()
      } catch (e) {
        this.$Notice.error({
          title: '获取失败',
          desc: '数据格式不正确，重新选择'
        })
      }
    },
    // 处理区级网格
    disposeNew (e, e1) {
      try {
        let data = {
          bubble: true,
          // fillColor: '#f77777',
          fillColor: e1,
          fillOpacity: '0.2',
          path: JSON.parse(e)
        }
        // this.polygons.push(data)
        // this.polygons[0].path.push()
        return data
      } catch (e) {
        this.$Notice.error({
          title: '获取失败',
          desc: '数据格式不正确，重新选择'
        })
      }
    },
    // 根据多边形自动取中心点
    autoCenter (map) {
      let path = JSON.parse(map)
      let total_lng = 0.0
      let total_lat = 0.0
      path.forEach(arr => {
        total_lng += arr[0]
        total_lat += arr[1]
      })
      let newlng = total_lng / path.length
      let newlat = total_lat / path.length
      let newCenter = [newlng, newlat]
      return newCenter
    },
    // 处理点部分
    disposeCscMapjson () {
      if (this.pickInfo.grade === '7') {
        this.markerOffset = [-15, -15]
      } else {
        this.markerOffset = [-25, -45]
      }
      if (this.pickInfo.csc_mapjson === undefined || this.pickInfo.csc_mapjson === '') {
        this.$Notice.error({ title: '中心点获取失败', desc: '该区域未添加中心点' })
        this.center = [123.412581, 41.805853]
      } else {
        let pickInfo_center = this.pickInfo.csc_mapjson
        let str = pickInfo_center.split(',')
        if (str.length !== 2) {
          this.$Notice.error({ title: '中心点获取失败', desc: '中心点数据格式不正确，重新选择' })
        }
        this.center = []
        this.center.push(str[0])
        this.center.push(str[1])
      }
    },
    // 调整缩放程度
    autoZoom () {
      if (this.pickInfo.grade === '7') {
        this.zoom = 18 // 楼
      } else if (this.pickInfo.grade === '6') {
        this.zoom = 17 // 小区
      } else if (this.pickInfo.grade === '5') {
        this.zoom = 17 // 社区
      } else if (this.pickInfo.grade === '4') {
        this.zoom = 14 // 街道
      } else if (this.pickInfo.grade === '3') {
        this.zoom = 13 // 区
      } else if (this.pickInfo.grade === '8') {
        this.zoom = 18 // 单元
      } else {
        this.zoom = 9
      }
    },
    // 当层级为网格时，查询展示楼
    getBuildingByGarden () {
      this.BuildingList = []
      let data = {
        grade: '6',
        id: this.pickInfo.id
      }
      console.log(data)
      findSubordinateList(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          result.forEach(item => {
            if (item.csc_mapjson !== undefined) {
              let center = [parseFloat(item.csc_mapjson.split(',')[0]), parseFloat(item.csc_mapjson.split(',')[1])]
              this.BuildingList.push(center)
            }
            if (item.zd !== undefined) {
              this.zdrqBuildingList.push(true)
            } else {
              this.zdrqBuildingList.push(false)
            }
          })
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // 当层级为街道时，查询展示网格
    getGarden () {
      let data = {
        grade: this.pickInfo.grade,
        id: this.pickInfo.id
      }
      findAllGridList(data).then(ret => {
        if (ret.data.errcode === 0) {
          if (ret.data.data.length > 0) {
            let result = ret.data.data
            result.forEach(item => {
              this.dispose(item.csc_mapjson)
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败！', desc: ret.data.msg })
        }
      })
    },
    // 根据 网格坐标获取统计信息
    getGridByGardenId (e, e1) {
      console.log('网格坐标获取统计信息')
      let data = {
        csc_mapjson: e,
        grade: e1
      }
      this.pickPath.path = e
      this.pickPath.grade = e1
      getGridByGardenId(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = {
            info: ret.data.data.info
          }
          console.log('网格坐标获取统计信息', result)
          this.disposeTypeWindosInfo(result)
          this.getBuildingNum(result.info.grade, result.info.id)
          this.getZbPersonNum(result.info.id) // 获取专班工作人员数量
          this.retuenGridInfoToIndex(result.info.grade, result.info.id)
        } else {
          this.$Notice.error({
            title: '查询失败！',
            desc: ret.data.errmsg
          })
        }
      })
    },
    getBuildingNum (e1, e2) {
      let data = {
        grade: e1,
        id: e2
      }
      getBuildingNum(data).then(ret => {
        if (ret.data.errcode === 0) {
          var vm = this
          vm.$set(vm.GridStatistics, 'buildingNum', ret.data.data.buildingNum)
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    getZbPersonNum (e2) {
      let data = {
        garden_id: e2
      }
      getSiteNum(data).then(ret => {
        if (ret.data.errcode === 0) {
          var vm = this
          console.log(ret.data.data.num, '数量')
          vm.$set(vm.GridStatistics, 'zbNum', ret.data.data.num)
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // 查询详情
    showDetail () {
      this.$refs.gridModule.init(this.pickInfo)
    },
    // 点击网格，或楼查询详情
    showDetailTwo () {
      let data = {
        csc_mapjson: this.pickPath.path
      }
      getBuildingByCoordinates(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          this.$refs.gridModule.init(result)
          // this.$refs.gridPerson.init(result)
        } else {
          this.$Notice.error({
            title: '查询失败！',
            desc: ret.data.errmsg
          })
        }
      })
    },
    // 查询场所商户
    findMerchantByMapList () {
      let data = {
        id: this.pickInfo.id,
        grade: this.pickInfo.grade
      }
      findMerchantByMapList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.placeList = []
          this.placeList = ret.data.data
          if (this.placeList.length !== 0) {
            this.placeList.forEach((item, index) => {
              let x = item.csc_mapjson.split(',')
              let y = []
              y.push(x[0])
              y.push(x[1])
              item.csc_mapjson1 = y
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // 查询场所商户
    findMerchantByMapListByType (e) {
      let data = {
        id: this.pickInfo.id,
        grade: this.pickInfo.grade,
        pid: e
      }
      return findMerchantByMapNewList(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          if (result.length !== 0) {
            result.forEach((item, index) => {
              let x = item.csc_mapjson.split(',')
              let y = []
              y.push(x[0])
              y.push(x[1])
              item.csc_mapjson1 = y
            })
          }
          return result
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // 查询场所商户
    findMerchantByMapListByTypeNew (e) {
      let data = {
        id: this.pickInfo.id,
        grade: this.pickInfo.grade,
        merchant_type: e
      }
      return findMerchantByMapNewList(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          if (result.length !== 0) {
            result.forEach((item, index) => {
              let x = item.csc_mapjson.split(',')
              let y = []
              y.push(x[0])
              y.push(x[1])
              item.csc_mapjson1 = y
            })
          }
          return result
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // 根据场所类型改变图标
    // changePic (e) {
    //   let x = ''
    //   switch (e.merchant_type) {
    //     case '1':
    //       x = './img/bank.png'
    //       break
    //     case '2':
    //       x = './img/public_institution.png'
    //       break
    //     case '3':
    //       x = './img/business.png'
    //       break
    //     case '4':
    //       x = './img/institution.png'
    //       break
    //     case '5':
    //       x = './img/park.png'
    //       break
    //     case '6':
    //       x = './img/square.png'
    //       break
    //   }
    //   return x
    // },
    // 查询社会组织
    findSocietyByMapList () {
      let data = {
        id: this.pickInfo.id,
        grade: this.pickInfo.grade
      }
      findSocietyByMapList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.societyList = []
          this.societyList = ret.data.data
          if (this.societyList.length !== 0) {
            this.societyList.forEach((item, index) => {
              let x = item.csc_mapjson.split(',')
              let y = []
              y.push(x[0])
              y.push(x[1])
              item.csc_mapjson1 = y
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // 查询物件列表
    findSubstanceByMapList () {
      let data = {
        id: this.pickInfo.id,
        grade: this.pickInfo.grade
      }
      findSubstanceByMapList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.substanceList = []
          this.substanceList = ret.data.data
          if (this.substanceList.length !== 0) {
            this.substanceList.forEach((item, index) => {
              let x = item.csc_mapjson.split(',')
              let y = []
              y.push(x[0])
              y.push(x[1])
              item.csc_mapjson1 = y
              // item.substance_type = this.substanceImg
            })
          }
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    // 点击数据弹出楼列表
    searchBuilding (e) {
      let data = {
        grade: e.grade,
        id: e.id
      }
      console.log(data)
      findBuidingRuhuList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.BuildingData = ret.data.data
          this.buildingModal = true
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    showBuilding (e) {
      // this.$refs.gridPersonNew.init(e, 1)
      let data = {
        buildingInfo: e,
        moduleInfo: {}
      }
      this.$refs.gridPersonNew.init(data)
    },
    findFocusGroupLabelList () {
      let data = {
        id: this.pickID,
        grade: this.pickGrade
      }
      console.log(data)
      findPeopleFocusGroupLabelList(data).then(ret => {
        if (ret.data.errcode === 0) {
          let result = ret.data.data
          result.forEach(item => {
            if (item.csc_mapjson !== undefined) {
              let center = [parseFloat(item.csc_mapjson.split(',')[0]), parseFloat(item.csc_mapjson.split(',')[1])]
              this.peopleBuildingList.push(center)
            }
          })
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    findPeopleFocusGroupLInfoList (e) {
      this.FocusGroupPeopleModel = true
      let data = {
        csc_mapjson: e
      }
      findPeopleFocusGroupLInfoList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.FocusGroupBuildingInfo = ret.data.data.buildingInfo[0]
          this.FocusGroupPeopleData = ret.data.data.resultList
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    async getPeopleInfo (e) {
      console.log(e)
      let data = {
        buildingInfo: {
          id: e.building_id
        },
        moduleInfo: {}
      }
      await this.$refs.gridPersonNew.init(data)
      this.$refs.gridPersonNew.detailUserInfo(e)
      this.$refs.gridPersonNew.findUserFocusGroupList(e)
    },
    searchZbPerson (e) { // 查看专班工作人员列表和人数统计
      this.zbDrawer = true
      findStatisticsInfo({ garden_id: e.id }).then(ret => {
        if (ret.data.errcode === 0) {
          console.log(ret.data.data, '统计人数')
          this.zbTypeNums = ret.data.data
        } else {
          this.$Notice.error({
            title: '查看专班工作人员数量失败',
            desc: ret.data.errmsg
          })
        }
      })
      findSiteList({ garden_id: e.id }).then(ret => {
        if (ret.data.errcode === 0) {
          this.data1 = ret.data.data
        } else {
          this.$Notice.error({
            title: '查看专班工作人员列表失败',
            desc: ret.data.errmsg
          })
        }
      })
    }
  },
  watch: {
    pickID (val) {
      if (val) {
        this.init()
      }
    },
    center (val) {
      this.window.center = val
    },
    Gridswitch (val) {
      this.init()
    }
  },
  mounted () {
    this.severUserInfo = this.$store.state.user.severUserInfo
  }
}
</script>

<style scoped>
.teshu>>>.amap-marker{
  z-index: 50;
}
.marker>>>.amap-markers{
  z-index: 150;
}
.body>>>.amap-info-content{
  padding: 0;
}
.info-window {
  text-align: left;
  width: 400px;
  height: 250px;
  padding:3px 15px;
  background:rgba(255,255,255,0.9);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  background:#235CA7;
  color: white;
}
.detail{
  width: 93%;
  height: 24px;
  color: #fff;
  background-color: #1a73e8;
  position: absolute;
  bottom: 0;
  font-size: 12px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 5px;
}
.divtitleClass{
  background-color: rgb(236, 248, 255);
  border-left: 5px solid rgb(80, 191, 255);
  border-radius: 4px;
  font-size: 16px;
  margin: 15px 0px;
  padding: 8px 12px;
  width: 100%;
}
.divclass{
  margin-bottom: 10px;
}
.divtitleClass{
  background-color: rgb(236, 248, 255);
  border-left: 5px solid rgb(80, 191, 255);
  border-radius: 4px;
  font-size: 16px;
  margin: 15px 0px;
  padding: 8px 12px;
  width: 100%;
}
.body >>> .ivu-modal-header p, .ivu-modal-header-inner {
  font-size: 18px;
}
.TLDIVClass{
  background: #235CA7;
  height: 40px;
  width: 300px;
  z-index: 1000;
  position: absolute;
  bottom: 50px;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  border-radius: 10px;
}
.TLDIVClass1{
  background: #235CA7;
  height: 40px;
  width: 970px;
  z-index: 1000;
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  border-radius: 10px;
}
.TLSpan{
  line-height: 40px;
  color: white;
  margin-left: 10px;
  margin-right: 10px;
  border: 1px solid #235CA7;
  padding: 5px;
  border-radius: 10px;
  cursor:pointer;
  -moz-user-select:none; /*火狐*/
  -webkit-user-select:none; /*webkit浏览器*/
  -ms-user-select:none; /*IE10*/
  -khtml-user-select:none; /*早期浏览器*/
  user-select:none;
}
.ClickTLSpan{
  border: 1px solid white;
}
  .zb-div {
    width:100%;float:left;font-size:13px;
  }
  .zb-div >>> .ivu-card-body {
    padding: 16px;
    padding-left: 0px;
    text-align: center;
  }
  .selectZbCard {
    border: 1px  solid #7eb3e9;
  }
</style>
